<template>
  <div class="mydetail">
    <ul>
      <li
      v-for="item in home.detailList"
      v-bind:key="item.id">
        <router-link :to="{path:'/commodity',query:{id : item.id}}">
          <div class="product">
            <div class="product-img">
              <img :src="item.path"/>
            </div>
            <div class="product-txt">
              <h3> {{item.text}}</h3>
              <span>
                {{item.text}}
              </span>
            </div>
            <div class="product-price">
              <span>￥</span>
              <span>{{item.price}}</span>
              <span>折后价</span>
            </div>
          </div>
        </router-link>
      </li>
      
    </ul>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["home"]),
  },
};
</script>

<style lang="less">
@import "../../assets/css/reset.css";
@import "../../assets/less/variable.less";

.mydetail {
    height: 100%;
    background: #f0f0f0;
  ul {
    width: 360px;
    height: 100%;
    background: #ccc;
    li {
      width: 170px;
      height: 250px;
      float: left;
      margin-left: 10px;
      margin-top: 10px;
      border-radius: 10px;
      background: #fff;
    }
  }
}
.product {
  width: 170px;
  height: 250px;
  border-radius: 10px;
  font-size: 12px;
  .product-img {
    height: 140px;
    img{
        width: 130px;
        height: 130px;
        display: block;
        margin: 10px auto 0;
    }
  }
  .product-txt {
    height: 65px;
    h3{
        padding-left: 5px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    span {
      width: 96%;
      height: 32px;
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      color:#737373;
      padding-left: 5px;
      padding-right: 5px;
    }
  }
  .product-price {
      padding-left: 5px;
    span {
      &:nth-of-type(1) {
        font-size: 12px;
        color: #b107d4;
      }
      &:nth-of-type(2) {
        font-size: 20px;
        font-weight: bold;
        color: #b107d4;
      }
      &:nth-of-type(3) {
        width: 45px;
        height: 15px;
        text-align: center;
        display: inline-block;
        color: #fff;
        font-size: 12px;
        background: #b107d4;
        margin-left: 8px;
         &::before{
            position: absolute;
            content: '';
            display: inline-block;
            width: 0px;
            height: 0px;
            border-top: 8px solid #b107d4;
            border-left: 5px solid transparent;
            margin-left: -8px;
        }
      }
    }
  }
}
</style>